package com.my.study.caffeine;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;

/**
 * @author Carlos
 * @version 1.0.0
 * @date 2023/2/25 18:17
 */
public class Test {

    public static void main(String[] args) {
        Cache<String, String> cache = Caffeine.newBuilder()
                .initialCapacity(2)
                .maximumSize(3)
                .build();
        
        
        cache.put("1", "1");
        cache.put("2", "2");
        cache.put("3", "3");
        cache.put("4", "4");


        String ifPresent = cache.get("4", s -> {
           return "5"; 
        });
            
    }
}
